# To run these tests, simply execute `nimble test`.

import unittest

import chineseNumber
test "basic":
  check toChinese(0) == "零"
  check toChinese(1) == "一"
  check toChinese(2) == "二"
  check toChinese(3) == "三"
  check toChinese(4) == "四"
  check toChinese(5) == "五"
  check toChinese(6) == "六"
  check toChinese(7) == "七"
  check toChinese(8) == "八"
  check toChinese(9) == "九"

test "1x and 1x0000 should skip 1":
  check toChinese(10) == "十"
  check toChinese(11) == "十一"
  check toChinese(100000) == "十万"
  check toChinese(100009) == "十万零九"
  check toChinese(101001) == "十万一千零一"
  check toChinese(10_0000_0000) == "十亿"
  check toChinese(10_0000_0009) == "十亿零九"
  check toChinese(10_9000_0009) == "十亿九千万零九"

test "complex":
  check toChinese(20) == "二十"
  check toChinese(22) == "二十二"
  check toChinese(100) == "一百"
  check toChinese(103) == "一百零三"
  check toChinese(110) == "一百一十"
  check toChinese(114) == "一百一十四"
  check toChinese(120) == "一百二十"
  check toChinese(1000) == "一千"
  check toChinese(1005) == "一千零五"
  check toChinese(1010) == "一千零一十"
  check toChinese(10000) == "一万"
  check toChinese(10006) == "一万零六"
  check toChinese(10107) == "一万零一百零七"
  check toChinese(1100) == "一千一百"
  check toChinese(1108) == "一千一百零八"

  check toChinese(10001000) == "一千万一千"
  check toChinese(10101010) == "一千零一十万一千零一十"
  check toChinese(10100101) == "一千零一十万零一百零一"
  check toChinese(200005000) == "二亿零五千"

test "very big number":
  # should be 9,223,372,036,854,775,807
  check toChinese(high(int)) == "九百二十二京三千三百七十二兆零三百六十八亿五千四百七十七万五千八百零七"
